package com.feri.cs.controller;

import com.feri.cs.dto.CarUseAdviceDto;
import com.feri.cs.dto.CarUseDto;
import com.feri.cs.service.CarUseService;
import com.feri.cs.vo.R;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;

/**
 * 3.车辆使用申请表(TCarUse)表控制层
 *
 * @author makejava
 * @since 2023-05-09 16:35:01
 */
@RestController
@CrossOrigin
@Api(tags = "车辆申请")
public class CarUseController {
    /**
     * 服务对象
     */
    @Resource
    private CarUseService carUseService;

    @PostMapping("/api/cu/add")
    public R add(@RequestBody CarUseDto dto){
        return carUseService.createUse(dto);
    }
    @GetMapping("/api/cu/my")
    public R my(int id){
        return carUseService.queryByUid(id);
    }
    @GetMapping("/api/cu/task")
    public R task(String role){
        return carUseService.queryTask(role);
    }
    @PostMapping("/api/cu/advice")
    public R advice(@RequestBody CarUseAdviceDto dto){
        return carUseService.adviceTask(dto);
    }
    @GetMapping("/api/cu/history")
    public R history(String pid){
        return carUseService.queryHistory(pid);
    }
}

